import 'package:wch/generated/json/base/json_convert_content.dart';
import 'package:wch/model/patient_label.dart';

PatientLabelModel $PatientLabelModelFromJson(Map<String, dynamic> json) {
  final PatientLabelModel patientLabelModel = PatientLabelModel();
  final String? code = jsonConvert.convert<String>(json['code']);
  if (code != null) {
    patientLabelModel.code = code;
  }
  final String? msg = jsonConvert.convert<String>(json['msg']);
  if (msg != null) {
    patientLabelModel.msg = msg;
  }
  final List<PatientAllLabelData>? data = (json['data'] as List<dynamic>?)
      ?.map(
          (e) =>
      jsonConvert.convert<PatientAllLabelData>(e) as PatientAllLabelData)
      .toList();
  if (data != null) {
    patientLabelModel.data = data;
  }
  return patientLabelModel;
}

Map<String, dynamic> $PatientLabelModelToJson(PatientLabelModel entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['code'] = entity.code;
  data['msg'] = entity.msg;
  data['data'] = entity.data?.map((v) => v.toJson()).toList();
  return data;
}

extension PatientLabelModelExtension on PatientLabelModel {
  PatientLabelModel copyWith({
    String? code,
    String? msg,
    List<PatientAllLabelData>? data,
  }) {
    return PatientLabelModel()
      ..code = code ?? this.code
      ..msg = msg ?? this.msg
      ..data = data ?? this.data;
  }
}

PatientAllLabelData $PatientAllLabelDataFromJson(Map<String, dynamic> json) {
  final PatientAllLabelData patientAllLabelData = PatientAllLabelData();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    patientAllLabelData.id = id;
  }
  final String? hospitalId = jsonConvert.convert<String>(json['hospitalId']);
  if (hospitalId != null) {
    patientAllLabelData.hospitalId = hospitalId;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    patientAllLabelData.name = name;
  }
  final int? type = jsonConvert.convert<int>(json['type']);
  if (type != null) {
    patientAllLabelData.type = type;
  }
  final String? colour = jsonConvert.convert<String>(json['colour']);
  if (colour != null) {
    patientAllLabelData.colour = colour;
  }
  final String? text = jsonConvert.convert<String>(json['text']);
  if (text != null) {
    patientAllLabelData.text = text;
  }
  final String? status = jsonConvert.convert<String>(json['status']);
  if (status != null) {
    patientAllLabelData.status = status;
  }
  final String? createTime = jsonConvert.convert<String>(json['createTime']);
  if (createTime != null) {
    patientAllLabelData.createTime = createTime;
  }
  final String? updateTime = jsonConvert.convert<String>(json['updateTime']);
  if (updateTime != null) {
    patientAllLabelData.updateTime = updateTime;
  }
  final bool? isChecked = jsonConvert.convert<bool>(json['isChecked']);
  if (isChecked != null) {
    patientAllLabelData.isChecked = isChecked;
  }
  return patientAllLabelData;
}

Map<String, dynamic> $PatientAllLabelDataToJson(PatientAllLabelData entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['hospitalId'] = entity.hospitalId;
  data['name'] = entity.name;
  data['type'] = entity.type;
  data['colour'] = entity.colour;
  data['text'] = entity.text;
  data['status'] = entity.status;
  data['createTime'] = entity.createTime;
  data['updateTime'] = entity.updateTime;
  data['isChecked'] = entity.isChecked;
  return data;
}

extension PatientAllLabelDataExtension on PatientAllLabelData {
  PatientAllLabelData copyWith({
    String? id,
    String? hospitalId,
    String? name,
    int? type,
    String? colour,
    String? text,
    String? status,
    String? createTime,
    String? updateTime,
    bool? isChecked,
  }) {
    return PatientAllLabelData()
      ..id = id ?? this.id
      ..hospitalId = hospitalId ?? this.hospitalId
      ..name = name ?? this.name
      ..type = type ?? this.type
      ..colour = colour ?? this.colour
      ..text = text ?? this.text
      ..status = status ?? this.status
      ..createTime = createTime ?? this.createTime
      ..updateTime = updateTime ?? this.updateTime
      ..isChecked = isChecked ?? this.isChecked;
  }
}